import { baseUrlApi, requestClient, type Result } from '#/api/request';

/** 导航列表 */
export const getNavs = (params?: object) => {
  return requestClient.get<Result>(baseUrlApi('/admin/navs'), { params });
};

/** 添加导航 */
export const postNavs = (data?: object) => {
  return requestClient.post<Result>(baseUrlApi('/admin/navs'), data);
};

/** 获取导航信息 */
export const getNavsInfo = (data: { id: number }) => {
  return requestClient.get<Result>(baseUrlApi(`/admin/navs/${data.id}`));
};

/** 编辑导航 */
export const putNavs = (data: any) => {
  return requestClient.put<Result>(baseUrlApi(`/admin/navs/${data.id}`), data);
};

/** 删除导航 */
export const deleteNavs = (data?: any) => {
  return requestClient.delete<Result>(
    baseUrlApi(`/admin/navs/${data.id}`),
    data,
  );
};

/** 获取共享nav模板结构 */
export const getNavsSelectNavs = () => {
  return requestClient.get<Result>(baseUrlApi('/admin/navs/select/navs'));
};
